package qj.tool.jna.support;

import java.awt.event.KeyEvent;
import java.util.Properties;

import qj.tool.build.BuildUtil;
import qj.tool.jna.KeyboardHandler;
import qj.ui.DesktopUI4;
import qj.util.Clipboard;
import qj.util.PropertiesUtil;
import qj.util.ThreadUtil;
import qj.util.funct.P0;

public class AutoLogin {
	public static void main(String[] args) {
		Properties config = PropertiesUtil.loadPropertiesFromFile("AutoLogin.properties");
		ThreadUtil.sleep(Long.parseLong(config.getProperty("init.delay")));
//		DesktopUI4.type(config.getProperty("login.username"));
		Clipboard.type(config.getProperty("login.username"));
		DesktopUI4.type(KeyEvent.VK_ENTER);

		ThreadUtil.sleep(Long.parseLong(config.getProperty("username.delay")));
//		DesktopUI4.type(KeyEvent.VK_TAB);
		Clipboard.type(config.getProperty("login.password"));
		DesktopUI4.type(KeyEvent.VK_TAB);
		DesktopUI4.type(KeyEvent.VK_SPACE);
	}
	public static class Build {
		public static void main(String[] args) {
			System.out.println(BuildUtil.buildApp(AutoLogin.class).getAbsolutePath());
		}
	}
}
